$(function() {
    $('#the_form').bootstrapValidator({
        feedbackIcons: {
            valid: 'glyphicon glyphicon-ok', //验证通过
            invalid: 'glyphicon glyphicon-remove', //验证失败
            validating: 'glyphicon glyphicon-refresh'
        },
        fields: {
            nickName: {
                selector: '#nickName',
                validators: {
                    notEmpty: {
                        message: '昵称不能为空'
                    }
                }
            },
            email: {
                selector: '#email',
                validators: {
                    emailAddress: {},
                    notEmpty: {
                        message: '邮箱不能为空'
                    },
                    remote: {
                        type: 'POST',
                        url: '/signin/isExist',
                        message: '用户名已存在',
                        delay: 1000
                    }
                }
            },
            password: {
                selector: '#password',
                validators: {
                    notEmpty: {
                        message: '密码不能为空'
                    },
                    stringLength: {
                        min: 6,
                        max: 16
                    },
                    different: {
                        field: 'email',
                        message: '密码不能和邮箱相同'
                    }
                }
            }
        }
    })
})
